package com.bbcare.followup.plat.store.ibatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.bbcare.followup.plat.entity.PatientQueueScheme;

/*
 * @name:         患者队列信息存储接口
 * @author:       DemonLee
 * @createTime:   2017.4.13
 * @description:  患者队列基本信息
 * @modify:
 *
 */
public interface IPatientQueueSchemeDAO {
    /**
     * 患者队列信息添加
     *
     * @param PatientQueueScheme
     * @return
     */
    public void savePatientQueueSchemeInfo(PatientQueueScheme pts) throws Exception;

    /**
     * 患者队列信息入历史表
     *
     * @param Map
     * @return
     */
    public void insertPatientQueueSchemeHis(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询患者队列list
     *
     * @param userId
     *            患者id
     * @return list
     */
    public List<PatientQueueScheme> selectByUserId(Map<String, Object> paramMap) throws Exception;

    /**
     * 统计指定条件下的患者队列list（如今日随访的患者）
     *
     * @param authorId
     *            医生登录账号 queueStatus 队列状态 userStatus 患者状态 taskStatus 任务状态
     *            endTime 截止时间 beginTime 起始时间
     * @return int
     */
    public int countTotalPtQueueNumByCondition(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询条件下的患者队列list（如今日随访的患者）
     *
     * @param authorId
     *            医生登录账号 queueStatus 队列状态 userStatus 患者状态 taskStatus 任务状态
     *            endTime 截止时间 beginTime 起始时间 start 开始条数 end 结束条数
     *
     *  @return list
     */
    public List<Map<String, Object>> selectPtQueueList(HashMap<String, Object> paramMap) throws Exception;

    /**
     * 查询队列里面正在管理的患者
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    List<PatientQueueScheme> selectPatientByCondition(Map<String, Object> paramMap) throws Exception;

    /**
     * 患者队列信息更新
     *
     * @param ptSchemeId
     * @return
     */
    public int updatePtQueueSchemeRecord(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询队列患者审核记录
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    List<Map<String, Object>> selectQueueAuditTask(Map<String, Object> paramMap) throws Exception;

    /**
     * 队列审核表更新
     *
     * @param paramMap
     * @return
     * @throws Exception
     */
    int updateAuditTask(Map<String, Object> paramMap) throws Exception;

    int selectQueueAuditTaskCount(Map<String, Object> paramMap) throws Exception;

    /**
     * 统计患者数量（有任务与无任务）
     *
     * @param totalNumZero/totalNumNonZero、queueIdIn
     * @return int
     */
    public int countTotalPtQueueNumByTaskNum(Map<String, Object> paramMap) throws Exception;

    // 根据条件查询队列暂停患者记录
    List<Map<String, Object>> selectQueueStopPatientlist(Map<String, Object> paramMap) throws Exception;

    // 根据条件查询队列暂停患者记录
    int selectQueueStopPatientCount(Map<String, Object> paramMap) throws Exception;

    /**
     * 统计随访记录总数
     */
    public int countPatientTaskFinishInfo(Map<String, Object> paramMap) throws Exception;

    /**
     * 统计随访记录总数(返回检测年龄）
     */
    public int countPatientTaskFinishAndAge(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询随访记录list
     *
     * @return list
     */
    public List<Map<String, Object>> selectPatientTaskFinishInfo(HashMap<String, Object> paramMap) throws Exception;

    /**
     * 查询随访记录list(返回检测年龄）
     *
     * @return list
     */
    public List<Map<String, Object>> selectPatientTaskFinishAndAge(HashMap<String, Object> paramMap) throws Exception;

    /**
     * 统计数据中心随机患者总数
     */
    public int countPatientDataCenter(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询统计数据中心随机患者list
     *
     * @return list
     */
    public List<Map<String, Object>> selectPatientDataCenter(HashMap<String, Object> paramMap) throws Exception;

    /**
     * 根据患者id查询队列信息
     *
     * @return map
     */
    public Map<String,Object> selectListInfoByPatientId(String patientId) throws Exception;

    /**
     * 统计指定条件下的失访患者记录list
     *
     * @param
     * @return int
     */
    public int countLostPtRdNumByCondition(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询指定条件下的失访患者记录list
     *
     * @param
     * @return list
     */
    public List<Map<String, Object>> listLostPtRdNumByCondition(HashMap<String, Object> paramMap) throws Exception;

    /**
     * 统计指定条件下的随访患者提醒记录list
     *
     * @param
     * @return int
     */
    public int countPtSmsRdNumByCondition(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询指定条件下的随访患者提醒记录list
     *
     * @param
     * @return list
     */
    public List<Map<String, Object>> listPtSmsRdNumByCondition(HashMap<String, Object> paramMap) throws Exception;

    /**
     * 统计指定条件下的临期患者队列list
     *
     * @param
     * @return int
     */
    public int countPtWarnQueueByCondition(Map<String, Object> paramMap) throws Exception;


    public int countPatientTaskFinishInfoOutpatient(Map<String, Object> paramMap) throws Exception;

    /**
     * 查询随访记录list
     *
     * @return list
     */
    public List<Map<String, Object>> selectPatientTaskFinishInfoOutpatient(HashMap<String, Object> paramMap) throws Exception;




    /**
     * 查询指定条件下的临期患者队列list
     *
     * @param
     * @return list
     */
    public List<Map<String, Object>> listPtWarnQueueByCondition(HashMap<String, Object> paramMap) throws Exception;

    /**
     * 查询指定年龄段条件下患者list
     *
     * @param
     * @return list
     */
    public List<Map<String, Object>> listPtAgeWin(Map<String, Object> paramMap) throws Exception;

    //查询指定年龄段条件下患者list 新短信发送方案
    public List<Map<String, Object>> listPtAgeWinNew(Map<String, Object> paramMap) throws Exception;


    public int updateBabyBindByuserId(Map<String, Object> paramMap) throws Exception;

    //查询用户门诊人数
    public int countTotalPtQueueNumByQueueId(Map<String, Object> paramMap) throws Exception;
    /**
     * 修改totalNum为totalNum-1
     * 删除任务时使用
     * @param paramMap
     * @return
     * @throws Exception
     */
    public int updatetotalNumIncrForDelTask(Map<String, Object> paramMap) throws Exception;


}
